# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-python-evtx
pkgname=('python2-python-evtx' 'python-python-evtx')
_pkgname=python-evtx
pkgver=0.8.1
pkgrel=1
pkgdesc='Pure Python parser for recent Windows event log files (.evtx).'
arch=('any')
url='https://pypi.org/project/python-evtx/#files'
license=('APACHE')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('e594f91805a0f144d8d85385ff50ead411029c465d4791eb51e48f1162c1cbd3a61b0332bb7014ad706ed51333f6ade36bc20b480303b33e485d6a497727c532')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-python-evtx() {
  depends=('python2' 'python2-six' 'python2-hexdump' 'python2-pytest'
           'python2-cov')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build

  for i in "$pkgdir/usr/bin/"* ; do
    mv $i "${i}2"
  done
}

package_python-python-evtx() {
  depends=('python' 'python-six' 'python-hexdump' 'python-pytest'
           'python-pytest-cov')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

